package icu.groot.alan.hotel.entity.req;

import icu.groot.alan.hotel.util.BizException;
import icu.groot.alan.hotel.util.GrootApi;
import icu.groot.alan.hotel.util.ResultCodeEnum;
import lombok.Data;

@Data
public class AccountRegisterRo {

    /**
     * 用户名
     */
    private String accName;

    /**
     * 用户账号手机号码
     */
    private String accPhone;

    /**
     * 用户密码
     */
    private String accPassword;

    public String getAccPhone() {
        return accPhone;
    }

    public void setAccPhone(String accPhone) {
        if (!GrootApi.Check.checkPhone(accPhone)){
            throw new BizException(ResultCodeEnum.FAILED.setMessage("号码不符合规则"));
        }
        this.accPhone = accPhone;
    }

    public String getAccPassword() {
        return accPassword;
    }

    public void setAccPassword(String accPassword) {
        if (accPassword == null || accPassword.equals("")){
            throw new BizException(ResultCodeEnum.FAILED.setMessage("密码不能为空"));
        }
        this.accPassword = accPassword;
    }

    public String getAccName() {
        return accName;
    }

    public void setAccName(String accName) {
        this.accName = accName;
    }
}
